<!--文章管理-->

<template>
    <div>
        <div style="margin:20px">
            <el-button :type="zs" @click="changeColor" size="medium">正本</el-button>
            <el-button style="margin-left:-7px" @click="changeColor2" :type="fb" size="medium">副本</el-button>
        </div>
        <!--这是正本的列表内容-->
        <div v-show="listFlag==1">
            <el-row :gutter="20">
                <el-col :span="18">
                    <el-form :label-position="labelPosition" label-width="80px" :inline="true" ref="formZ" :model="pageAboutZ">
                        <el-form-item prop="enterprise_name" label="企业名称">
                            <el-input placeholder="输入关键词搜索" v-model="pageAboutZ.enterprise_name"></el-input>
                        </el-form-item>
                        <el-form-item prop="editor_person" label="操作人">
                            <el-input placeholder="输入关键词搜索" v-model="pageAboutZ.editor_person"></el-input>
                        </el-form-item>
                        <el-form-item >
                            <el-button type="primary" @click="resetForm('formZ')">重置</el-button>
                        </el-form-item>
                        <el-form-item>
                            <el-button type="primary" @click="foundZ">查找</el-button>
                        </el-form-item>
                    </el-form></el-col>
            </el-row>
            <div class="dateMsg" v-if="pageCountZ" style="color: red">总计<b>{{pageCountZ}}</b>条数据</div>
            <el-table :data="tableDataZ" style="width: 100%" v-loading="listLoading">
                <el-table-column prop="enterprise_name" label="名称">
                </el-table-column>
                <el-table-column prop="enterprise_type" label="类型" >
                </el-table-column>
                <el-table-column prop="is_list" label="上市情况" >
                </el-table-column>
                <el-table-column prop="contact_state" label="联络状态">
                </el-table-column>
                <el-table-column prop="ability" label="能力项">
                </el-table-column>
                <el-table-column prop="editor_person" label="操作人">
                </el-table-column>
                <el-table-column prop="date" label="管理">
                    <template scope="scope">
                        <!--<el-button v-if="scope.row.flag==1" type="text" size="small" @click="forBidden()">启用</el-button>-->
                        <el-button  type="text" size="small" @click="forBiddenj(scope.row.enterprise_id)">禁用</el-button>
                        <el-button  type="text" size="small" @click="look(scope.row.enterprise_id)">查看</el-button>
                        <el-button v-if="scope.row.firstData==false" type="text" size="small" @click="up(scope.row.enterprise_id)">上移</el-button>
                        <el-button v-if="scope.row.lastData==false" type="text" size="small" @click="down(scope.row.enterprise_id)">下移</el-button>
                        <!--<el-button v-else type="text" size="small" @click="forBidden(scope.row.enterprise_id,1)">禁用</el-button>-->
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination" style="width:200px;margin-top:10px;margin-left:75% ">
                <el-pagination layout="prev, pager, next"  :total='pageCountZ' @current-change="getCurrentpageZ" :page-size=10 ></el-pagination>
            </div>
        </div>
        <!--这是副本的列表内容-->
        <!---->
        <div v-show="listFlag==2">
            <!--<div>-->
            <el-form :label-position="labelPosition" label-width="80px" :inline="true" ref="form" :model="pageAbout">
                <el-form-item prop="contact_state" label="联络状态">
                    <el-select v-model="pageAbout.contact_state">
                        <el-option :label="item.name" :value="item.id" v-for="item in stateMessage"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item prop="logo_state" label="logo状态">
                    <el-select v-model="pageAbout.logo_state">
                        <el-option label="已上传" value="1"></el-option>
                        <el-option label="未上传" value="0"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item prop="case_relation" label="关联案例">
                    <el-select v-model="pageAbout.case_relation">
                        <el-option label="已关联" value="1"></el-option>
                        <el-option label="未关联" value="0"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item prop="editor_person" label="操作人">
                    <el-input placeholder="输入关键词搜索" v-model="pageAbout.editor_person"></el-input>
                </el-form-item>
                <el-form-item prop="enterprise_name" label="企业名称">
                    <el-input placeholder="输入关键词搜索" v-model="pageAbout.enterprise_name"></el-input>
                </el-form-item>
                <el-form-item >
                    <el-button type="primary" @click="resetForm('form')">重置</el-button>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="found">查找</el-button>
                </el-form-item>
            </el-form>
            <div class="dateMsg" v-if="pageCount" style="color: red">总计<b>{{pageCount}}</b>条数据</div>
            <el-table :data="tableData" style="width: 100%" v-loading="listLoading">
                <el-table-column prop="enterprise_name" label="名称">
                </el-table-column>
                <el-table-column prop="enterprise_type" label="类型" >
                </el-table-column>
                <el-table-column prop="is_list" label="上市情况" >
                </el-table-column>
                <el-table-column prop="contact_state" label="联络状态">
                </el-table-column>
                <el-table-column prop="ability" label="能力项">
                </el-table-column>
                <el-table-column prop="editor_person" label="操作人">
                </el-table-column>
                <el-table-column prop="date" label="管理">
                    <template scope="scope">
                        <el-button  v-if="scope.row.enterprise_logo==''" type="text" size="small" @click="uplogo('addlogo',scope.row.enterprise_id,scope.row.enterprise_logo)">上传logo</el-button>
                        <el-button v-else type="text" size="small" @click="uplogo('addlogo',scope.row.enterprise_id,scope.row.enterprise_logo)">重传logo</el-button>
                        <el-button type="text" size="small" @click="upCase('addCase',scope.row.enterprise_id)">关联案例</el-button>
                        <el-button v-if='scope.row.is_original==0' type="text" size="small" @click="forBiddenq(scope.row.enterprise_id)">启用</el-button>
                        <el-button v-else type="text" size="small" @click="forBiddenj(scope.row.enterprise_id)">禁用</el-button>
                        <!--<el-button v-else type="text" size="small" @click="forBidden(scope.row.enterprise_id,1)">禁用</el-button>-->
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination" style="width:200px;margin-top:10px;margin-left:75% ">
                <el-pagination layout="prev, pager, next"  :total='pageCount' @current-change="getCurrentpage" :page-size=10 ></el-pagination>
            </div>
            <el-dialog title="关联案例" :visible.sync="dialog.addCase.open" v-if="dialog.addCase.open" :modal="false" top="15%">
                <div style="margin:20px">
                    <el-button :type="zs3" @click="changeColor3" size="small">已关联</el-button>
                    <el-button style="margin-left:-7px" @click="changeColor4" :type="fb3" size="small">未关联</el-button>
                </div>
                <!--第一个表格-->
                <div v-show="flag">
                    <el-row :gutter="20">
                        <el-col :span="24">
                            <el-form :label-position="labelPosition" label-width="80px" :inline="true" ref="formL" :model="pageAboutL" style="margin-left:600px">
                                <el-form-item prop="title">
                                    <el-input placeholder="输入案例关键词搜索" v-model="pageAboutL.project_name"></el-input>
                                </el-form-item>
                                <el-form-item>
                                    <el-button type="primary" @click="foundL">查找</el-button>
                                </el-form-item>
                            </el-form></el-col>
                    </el-row>
                    <el-table :data="tableDataL" style="width: 100%" v-loading="listLoadingL">
                        <el-table-column prop="project_name" label="案例名称">
                        </el-table-column>
                        <!--:formatter="banFormat"-->
                        <el-table-column prop="case_type_name" label="承担角色" >
                        </el-table-column>
                        <el-table-column prop="date" label="操作">
                            <template scope="scope">
                                <el-button  type="text" size="small" @click="cancelLink(scope.row.case_id,scope.row.case_type)">取消关联</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                    <!--<div class="pagination" style="width:200px;margin-top:10px;margin-left:75% ">-->
                        <!--<el-pagination layout="prev, pager, next"  :total='pageCount' @current-change="getCurrentpage" :page-size=10 ></el-pagination>-->
                    <!--</div>-->
                </div>
                <!--第二个表格-->
                <div v-show="flag1">
                    <el-row :gutter="20">
                        <el-col :span="24">
                            <el-form :label-position="labelPosition" label-width="80px" :inline="true" ref="form" :model="pageAboutN" style="margin-left:600px">
                                <el-form-item prop="project_name">
                                    <el-input placeholder="输入案例关键词搜索" v-model="pageAboutN.project_name"></el-input>
                                </el-form-item>
                                <el-form-item>
                                    <el-button type="primary" @click="foundN">查找</el-button>
                                </el-form-item>
                            </el-form></el-col>
                    </el-row>
                    <div class="dateMsg" v-if="pageCountN" style="color: red">总计<b>{{pageCountN}}</b>条数据</div>
                    <el-table :data="tableDataN" style="width: 100%" v-loading="listLoadingN">
                        <el-table-column prop="project_name" label="案例名称">
                        </el-table-column>
                        <!--<el-table-column prop="title" label="角色选择" width="400px">-->
                        <!--<template scope="scope">-->
                        <!--<el-checkbox-group v-model="checkList1">-->
                        <!--<el-checkbox label="设计"></el-checkbox>-->
                        <!--<el-checkbox label="金融"></el-checkbox>-->
                        <!--<el-checkbox label="设备"></el-checkbox>-->
                        <!--<el-checkbox label="承建"></el-checkbox>-->
                        <!--<el-checkbox label="运维"></el-checkbox>-->
                        <!--</el-checkbox-group>-->
                        <!--</template>-->
                        <!--</el-table-column>-->
                        <el-table-column prop="date" label="操作">
                            <template scope="scope">
                                <el-button  type="text" size="small" @click="choseRole(scope.row.id)">角色选择</el-button>
                                <el-button  type="text" size="small" @click="toLink(scope.row.id)">关联</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                    <div class="pagination" style="width:200px;margin-top:10px;margin-left:75% ">
                        <el-pagination layout="prev, pager, next"  :total='pageCountN' @current-change="getCurrentpageN" :page-size=10 ></el-pagination>
                    </div>
                </div>
            </el-dialog>
            <el-dialog title="上传logo" :visible.sync="dialog.addlogo.open" v-if="dialog.addlogo.open" :modal="false" top="15%" size="tiny" :show-close="false" :close-on-click-modal="false">
                <div >
                    <el-upload
                            :action=fileUploadAction
                            :show-file-list="false"
                            :on-error="err"
                            :on-success="handleAvatarSuccess"
                            :before-upload="beforeAvatarUpload"
                            class="avatar-uploader">
                        <img v-if="imageUrl" :src=imageUrl class="avatar">
                        <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                        <div slot="tip" class="el-upload__tip">（支持png/jpg格式，点击可更换）</div>
                    </el-upload>
                </div>
                <div style="margin: 40px">
                    <el-button type="primary"  @click="upPic('addlogo')">确定</el-button>
                    <el-button @click="noPic('addlogo')">取消</el-button>
                </div>

            </el-dialog>
            <el-dialog title="角色选择" :visible.sync="dialog.choseRole.open" v-if="dialog.choseRole.open" :modal="false" top="15%" size="tiny" :show-close="false" :close-on-click-modal="false">
                <template>
                    <el-checkbox-group v-model="checkList">
                        <el-checkbox label="1">设计</el-checkbox>
                        <el-checkbox label="2">承建</el-checkbox>
                        <el-checkbox label="3">设备</el-checkbox>
                        <el-checkbox label="4">运维</el-checkbox>
                        <el-checkbox label="5">资金</el-checkbox>
                    </el-checkbox-group>
                </template>
                <div style="margin: 40px">
                    <el-button type="primary"  @click="yes('choseRole')">确定</el-button>
                    <el-button @click="no('choseRole')">取消</el-button>
                </div>

            </el-dialog>
        </div>
    </div>
</template>
<script>
    import Bus from '@/config/bus.js'
    import _http from '@/components/common/http.vue'
    import _param from '@/components/common/param.vue'
    import fabuxxi from '@/components/message/fabuxxi.vue'
    export default {
        components:{fabuxxi},
        data() {
            return {
                flagid:'',
//                不是logo地址
                logoPic:'',
//                logo地址
                enterprise_logo:'',
//                logo企业id
                logoid:'',
                stateMessage:'',
                gl:3,
                flag:true,
                flag1:false,
                listFlag:1,
                checkList: [],
                zs:'primary',
                fb:'',
                zs3:'primary',
                fb3:'',
                value3: true,
                userid:'',
                listLoading:false,
                listLoadingN:false,
                listLoadingL:false,
                currentPage:1,
                currentPageZ:1,
                currentPageN:1,
                pageCount:0,
                pageCountZ:0,
                pageCountN:0,
                pageCountL:0,
                pageAbout:{
                    userid:'',
//                    title:'',
                    pageNumber:1,
                    pageSize:10,
                    editor_person:'',
                    contact_state:'',
                    logo_state:'',
                    case_relation:'',
                    enterprise_name:'',
                    is_original:'0',
                    involve_field:'30',
                },
                pageAboutZ:{
                    userid:'',
                    title:'',
                    pageNumber:1,
                    pageSize:10,
                    editor_person:'',
                    enterprise_name:'',
                    involve_field:'30',
                    is_original:'1'
                },
                pageAboutN:{
                    userid:'',
                    enterprise_id:'',
                    pageNumber:1,
                    pageSize:10,
                    project_name:''
                },
                pageAboutL:{
                    userid:'',
                    enterprise_id:'',
                    project_name:''
                },
                apiPort:{
                    changePlace:'ecology/chart/upOrDown',
//                    联络状态接口
                    stateApi:'diction/getEnterpriseType',
///                    副本列表页内容接口
                    msgList:"ecology/chart/designConsultList",
//                    启用
                    forbidq:'ecology/chart/enable',
//                    禁用
                    forbidj:'ecology/chart/disable',
//                    删除接口
                    del:'information/delete',
//                    未关联的
                    noLink:'ecology/chart/relateProjectCasePage',
//                    检查是否关联的接口
                    checkLink:'ecology/chart/checkIsRelate',
//                    去覆盖关联选项的接口
                    toLink:'ecology/chart/relateProjectCase',
//                    副本已经关联的列表接口
                    linkAlready:'ecology/chart/relateProjectCaseList',
//                    副本取消关联的企业
                    cancelLink:'ecology/chart/cancelRelate',
//                    上传logo
                    upLogo:'ecology/chart/uploadLogo'
                },
                fileUploadAction:_param.param.fileUploadUrl,
                activeName: 'second',
                labelPosition: 'right',
                originid:'',
                linkid:'',
                tableData: [],
                tableDataZ: [],
                tableDataAll:[],
                tableDataN:[],
                tableDataL:[],
                imageUrl: '',
                //                控制弹出层的数据
                dialog:{
                    addCase:{
                        open:false
                    },
                    addlogo:{
                        open:false
                    },
                    choseRole:{
                        open:false
                    }
                },
            };

        },
        mounted(){
            this.limit = JSON.parse(localStorage.getItem("limitList"))
            this.userid=localStorage.getItem('userId')
            this.pageAbout.userid = localStorage.getItem('userId')
            this.pageAboutZ.userid = localStorage.getItem('userId')
            this.pageAboutN.userid = localStorage.getItem('userId')
            this.pageAboutL.userid = localStorage.getItem('userId')
            this.getCurrentpage(1)
            this.getCurrentpageZ(1)
            var that=this
            that.getLinkstate()
        },
        beforeDestroy(){
            Bus.$off("closeA")
        },
        methods: {
//            副本取消关联
            cancelLink(cid,ctype){
                var that = this
                var stateCom={caseid:cid,userid:that.userid,enterprise_id:this.pageAboutL.enterprise_id,case_type:ctype}
//                console.log(stateCom)
                var statesCom = that.querystring.stringify(stateCom)
                _http.axiosRequest(that,that.apiPort.cancelLink,statesCom,(res)=>{
                    console.log(res)
                if(res.data.code==100){
                    this.$message({
                        type: 'success',
                        message: '取消关联成功!'
                    });
                    that.getCurrentpageL()
                }

            })
            },
//            上传logo
            upPic(par){
                var that = this
//				企业联络状态
                this.enterprise_logo=this.logoPic
                var stateCom={enterprise_id:this.logoid,userid:that.userid,enterprise_logo:this.enterprise_logo}
                var statesCom = that.querystring.stringify(stateCom)
                _http.axiosRequest(that,that.apiPort.upLogo,statesCom,(res)=>{
                    console.log(res.data.code)
                if(res.data.code==100){
                    that.imageUrl=''
                    that.$message({
                        type: 'success',
                        message: '上传成功'
                    });
                    that.getCurrentpage(that.currentPage)
                }else{
                    that.$message({
                        type: 'warning',
                        message: '上传失败，请重新尝试'
                    });
                }
            })

                    this.closeDialog(par)
            },
            noPic(par){
                this.logoPic=''
                this.imageUrl=''
                this.closeDialog(par)
            },

//            关联各项
            yes(par){
                if(this.checkList.length==0){
                    this.$message({
                        type: 'info',
                        message: '未选择任何选项'
                    });
                }else{
                    this.closeDialog(par)
                }
            },
            no(par){
                this.checkList=[]
                this.closeDialog(par)
            },
            up(id){
                for(var i in this.tableDataAll){
                    if(id===this.tableDataAll[i].enterprise_id){
                        var a = this.tableDataAll.indexOf(this.tableDataAll[i])
                        if(a!=0){
//                            console.log('a='+a)
                            var b = this.tableDataAll[a-1]
//                            console.log(b)
//                            alert(b.enterprise_id)
                            this.changeState('up',id,b.enterprise_id)

                        }
                    }
                }
            },
            down(id){
                for(var i in this.tableDataAll){
                    if(this.tableDataAll[i].enterprise_id==id){
                        var a = this.tableDataAll.indexOf(this.tableDataAll[i])
                            var b = this.tableDataAll[a+1]

                        this.changeState('down',id,b.enterprise_id)

                    }
                }
            },
//            去关联
            toLink(id){
                var that = this
                this.linkid=id
                var stateCom={userid:that.userid,caseid:id,roles:this.checkList}
                if(id!=this.flagid){
                    this.$message({
                        type: 'info',
                        message: '关联不匹配'
                    });
                }else{
                    console.log(stateCom)
                    var statesCom = that.querystring.stringify(stateCom)
                    _http.axiosRequest(that,that.apiPort.checkLink,statesCom,(res)=>{
                        console.log(res.data.code)
                    if(res.data.code==-500){
                        var that = this
                        this.$confirm(res.data.msg, '提示', {
                            confirmButtonText: '确定',
                            cancelButtonText: '取消',

                        }).then(() => {
                            that.reallyLink()

                    }).catch(() => {

                        });

                    }else{
                        this.reallyLink()
                    }

                })
                }

            },
//            确定关联后调用的函数
        reallyLink(){
            var that = this
            var stateCom={userid:that.userid,caseid:this.linkid,roles:this.checkList,enterprise_id:this.originid}
            console.log(stateCom)
            var statesCom = that.querystring.stringify(stateCom)
            _http.axiosRequest(that,that.apiPort.toLink,statesCom,(res)=>{
                console.log(res)
               if(res.data.code==100){
                this.$message({
                    type: 'success',
                        message: '关联成功!'
                    });
                   that.getCurrentpageN(that.currentPageN)
                   }

            })
        },
            changeState(fx,oldid,newid){
                var that = this
                var stateCom={opeartion:fx,userid:that.userid,enterprise_id:oldid,swap_enterpriseid:newid,source:'design_consult'}
                console.log(stateCom)
                var statesCom = that.querystring.stringify(stateCom)
                _http.axiosRequest(that,that.apiPort.changePlace,statesCom,(res)=>{
                    console.log(res)
                    that.getCurrentpageZ(that.currentPageZ)
            })
            },
            getLinkstate(){
                var that = this
//				企业联络状态
                var stateCom={code:"contactState",userid:that.userid}
                var statesCom = that.querystring.stringify(stateCom)
                _http.axiosRequest(that,that.apiPort.stateApi,statesCom,(res)=>{
                    that.stateMessage=res.data.data
            })
            },
            choseRole(id){
                this.flagid=id
                this.openDialog('choseRole')
                this.checkList=[]
            },
            changeColor2(){
                this.zs=''
                this.fb='primary'
                this.listFlag=2
                this.getCurrentpage(1)
            },
            changeColor(){
                this.zs='primary'
                this.fb=''
                this.listFlag=1
                this.getCurrentpageZ(1)

            },
            changeColor3(){
                this.zs3='primary'
                this.fb3=''
//                this.gl=3
                this.flag=true
                this.flag1=false
                this.getCurrentpageL()
            },
            changeColor4(){

                this.zs3=''
                this.fb3='primary'
//                this.gl=4
                this.flag1=true
                this.flag=false
                this.getCurrentpageN(1)
            },
            beforeAvatarUpload(file) {
//                const isJPG = file.type === 'image/jpeg';
                const isLt2M = file.size / 1024 / 1024 < 10;

                if (!(file.type == 'image/jpeg'||file.type == 'image/png')) {
                    this.$message.error('图片只能是 JPG或者PNG 格式!');
                }
                if (!isLt2M) {
                    this.$message.error('图片大小不能超过 10MB!');
                }
                return isLt2M&&(file.type == 'image/jpeg'||file.type == 'image/png');
            },
            handleChange(file, fileList) {
                this.fileList3 = fileList.slice(-1);
//                this.form.attachment=file.url
            },
            err(){
                this.$message.error('上传失败');
            },
            handleAvatarSuccess(res, file) {
                this.imageUrl = URL.createObjectURL(file.raw);
                console.log(res.url)
                this.logoPic=res.url
//                this.form.picture=res.url
            },
            uplogo(par,id,src){
                this.openDialog(par)
                this.logoid=id
                this.imageUrl=src

            },
            upCase(par,id){
                this.originid=id
                this.openDialog(par)
                this.pageAboutN.enterprise_id=id
                this.pageAboutL.enterprise_id=id

//                N表示没有关联 L 表示关联过的 Z表示正本
//                没有的是副本
                this.getCurrentpageN(1)
                this.getCurrentpageL()
            },
            openDialog(dialog){
                this.dialog[dialog].open = true
            },
            closeDialog(dialog){
                this.dialog[dialog].open = false
            },
            found(){
                this.pageAbout.pageNumber=1
                this.getCurrentpage(1)
            },
            foundZ(){
                this.pageAboutZ.pageNumber=1
                this.getCurrentpageZ(1)
            },
            foundN(){
                this.pageAboutN.pageNumber=1
                this.getCurrentpageN(1)
            },
            foundL(){
//                this.pageAboutN.pageNumber=1
                this.getCurrentpageL()
            },
            resetForm(formName){
                this.$refs[formName].resetFields();
            },
            //跳转到指定页
//            副本内容获取
            getCurrentpage(val){
                this.listLoading=true
                var that = this
                this.currentPage = val ? val:1
                this.pageAbout.pageNumber=val ? val:1
                var params = that.querystring.stringify(this.pageAbout)
                _http.axiosRequest(that,that.apiPort.msgList,params,(res)=>{
                    console.log(res)
                    that.pageCount=res.data.data.total
                this.listLoading=false
                that.tableData = res.data.data.records
            })
            },
//            正本内容接口
            getCurrentpageZ(val){
                this.listLoading=true
                var that = this
                this.currentPageZ = val ? val:1
                this.pageAboutZ.pageNumber=val ? val:1
                var params = that.querystring.stringify(this.pageAboutZ)
                _http.axiosRequest(that,that.apiPort.msgList,params,(res)=>{
//                    console.log(res)
                    that.pageCountZ=res.data.data.total
                this.listLoading=false
                that.tableDataAll=res.data.data.records
                console.log(that.tableDataAll)
                if(res.data.data.records.length==12){
                    that.tableDataZ = res.data.data.records.slice(1,11)
                    console.log( that.tableDataZ)
                    console.log(res.data.data.records)
                }else if(res.data.data.records.length==11&&that.currentPageZ==1){
                    that.tableDataZ = res.data.data.records.slice(0,10)
                }else if(res.data.data.records.length==11&&that.currentPageZ!=1){
                    that.tableDataZ = res.data.data.records.slice(1)
                }else if(res.data.data.records.length==10&&that.currentPageZ!=1){
                    that.tableDataZ = res.data.data.records.slice(1)
                    console.log(that.tableDataZ)
                }else if(res.data.data.records.length<10&&that.currentPageZ!=1){
                    that.tableDataZ = res.data.data.records.slice(1)
                }else{
                    that.tableDataZ = res.data.data.records
                }
            })
            },
            getCurrentpageN(val){
                this.listLoadingN=true
                var that = this
                this.currentPageN = val ? val:1
                this.pageAboutN.pageNumber=val ? val:1
                var params = that.querystring.stringify(this.pageAboutN)
                _http.axiosRequest(that,that.apiPort.noLink,params,(res)=>{
                    console.log(res)
                that.pageCountN=res.data.data.total
                this.listLoadingN=false
                that.tableDataN = res.data.data.records
            })
            },
//            关联案例列表接口
            getCurrentpageL(val){
                this.listLoadingL=true
                var that = this
//                this.currentPageN = val ? val:1
//                this.pageAboutN.pageNumber=val ? val:1
                var params = that.querystring.stringify(this.pageAboutL)
                _http.axiosRequest(that,that.apiPort.linkAlready,params,(res)=>{
                    console.log(res)
//                that.pageCountL=res.data.data.total
                this.listLoadingL=false
                that.tableDataL = res.data.data
            })
            },
            banFormat:function(row,column){
                var ban = row[column.property];
                if ( ban == 1 ){
                    return "禁用";
                }
                return "启用";
            },
            //        启用禁用
            forBiddenq(id){
                var that = this
                var param = {enterprise_id:id,source:'design_consult',userid:that.userid}
                var params = that.querystring.stringify(param)
                _http.axiosRequest(that,that.apiPort.forbidq,params,(res)=>{
                    console.log(res.data)
                that.getCurrentpage(that.currentPage)
            })
            },
            forBiddenj(id){
                var that = this
                var param = {enterprise_id:id,source:'design_consult',userid:that.userid}
                var params = that.querystring.stringify(param)
                _http.axiosRequest(that,that.apiPort.forbidj,params,(res)=>{
                    console.log(res.data)
                that.getCurrentpageZ(that.currentPageZ)
            })
            },
//            删除接口
            del(id){
                var that = this
                this.$confirm('此操作将删除该消息, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    var param = {id:id,userid:that.userid}
                    var params = that.querystring.stringify(param)
                    _http.axiosRequest(that,that.apiPort.del,params,(res)=>{
                    console.log(res.data)
                that.getCurrentpage(that.currentPage)
                if(res.data.code==100){
                    that.$message({
                        message: '删除成功',
                        type: 'success'
                    });
//                    that.getCurrentpage(that.currentPage)
                }else{
                    that.$message({
                        message: res.data.msg,
                        type: 'warning'
                    });
                }
            })
            }).catch(() => {

                });
//                var that = this
//                var param = {id:id,userid:that.userid}
//                var params = that.querystring.stringify(param)
//                _http.axiosRequest(that,that.apiPort.del,params,(res)=>{
//                    console.log(res.data)
//                that.getCurrentpage(that.currentPage)
//            })
            },
            handleClick(tab, event) {
                console.log(tab, event);
            },
            go(){
                this.$router.push({path:'/message/fabuxxi',query:{info:1,page:this.currentPage}})
            },
            edit(id){
                this.$router.push({path:'/message/fabuxxi',query:{info:id,page:this.currentPage}})
            },
            look(id){
                this.$router.push({path:'/ecological/look',query:{info:id}})
            }
        }
    };
</script>
<style>
    .avatar-uploader-icon {
        font-size: 28px;
        color: #8c939d;
        width: 178px;
        height: 178px;
        line-height: 178px;
        text-align: center;
    }
</style>